<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-boxinfo-edit" th:object="${boxinfo}">
            <input id="boxGuid" name="boxGuid" th:field="*{boxGuid}"  type="hidden">
            <input name="boxSsqyid"  type="hidden" id="treeId"/>
            <div class="form-group">	
                <label class="col-sm-3 control-label">名称：</label>
                <div class="col-sm-8">
                    <input id="boxName" name="boxName" th:field="*{boxName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">地址：</label>
                <div class="col-sm-8">
                    <input id="boxDz" name="boxDz" th:field="*{boxDz}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">所属区域：</label>
                <div class="col-sm-8">
                    <input id="treeName" name="boxSsqymc"   onclick="selectDeptTree()" readonly="true" th:field="*{boxSsqymc}" class="form-control" type="text">
                </div>
            </div>
           
            <div class="form-group">	
                <label class="col-sm-3 control-label">设备编号：</label>
                <div class="col-sm-8">
                    <input id="boxSbbh" name="boxSbbh" th:field="*{boxSbbh}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">副本个数：</label>
                <div class="col-sm-8">
                    <input id="boxFbgs" name="boxFbgs" th:field="*{boxFbgs}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">柜子状态：</label>
                <div class="col-sm-8">
                <select id="boxType" name="boxType" th:field="*{boxType}" class="form-control">
						<option value ="1">正常</option>
						<option value ="0">初始注册</option>
						<option value ="2">停用</option>						
					</select>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">柜子是否计费：</label>
                <div class="col-sm-8">
                  <select id="boxSfqk" th:field="*{boxSfqk}" name="boxSfqk" class="form-control">
						<option value ="1">计费</option>
						<option value ="0">包柜</option>	
						<option value ="3">业主收费</option>										
					</select>
                </select>
                   
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">服务电话：</label>
                <div class="col-sm-8">
                    <input id="boxFwdh" th:field="*{boxFwdh}" name="boxFwdh" class="form-control" type="text">
                </div>
            </div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
					<button onclick="sendFwCq()" class="btn btn-danger" type="button">重启</button>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "ebox/boxinfo"
		$("#form-boxinfo-edit").validate({
			rules:{
				boxName:{
					required:true,
				},
				boxSsqyid:{
					required:true,
				},
				boxSsqymc:{
					required:true,
				},
				boxFbgs:{
					required:true,
				},
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/edit", $('#form-boxinfo-edit').serialize());
			}
		});
		
		 /*用户管理-新增-选择部门树*/
        function selectDeptTree() {
            var treeId = $("#treeId").val();
            var deptId = treeId == null || treeId == "" ? "100" : treeId;
            var url = ctx + "system/dept/selectDeptTree/" + deptId;
            $.modal.open("选择部门", url, '380', '380');
        }
		 function sendFwCq(){
			 
			 $.modal.confirm("确认要重启快递柜吗?", function() {
     			var url = ctx +"api-v1/manager/sendKdgCQ";
     			 var deviceId = $("#boxSbbh").val();
     			var data = { "deviceId": deviceId };
     			
     			$.post(ctx + "api-v1/manager/sendKdgCQ", {
     				deviceId:deviceId
					}, function(result) {
						
					}, 'json').error(function() {
					});
     		});
		 }
	</script>
</body>
</html>
